package com.liuzhilong.infrastructure.framework.netty.api.standard.processer;

import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListenableFutureTask;
import com.liuzhilong.infrastructure.framework.netty.api.standard.command.Command;
import com.liuzhilong.infrastructure.framework.netty.api.standard.command.CommandType;
import io.netty.channel.ChannelHandlerContext;

import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.Future;

/**
 * 处理器的 基类
 * 调整为基于future模式
 */
public abstract class AbstractProcessor<T> implements Processor {

    @Override
    public void processor(ChannelHandlerContext channelHandlerContext, Command command) {
        doProcessor(channelHandlerContext,parse(command));

    }

    /**
     * 转化command
     * @param command
     * @return
     */
    protected abstract T parse(Command command);
    protected abstract void doProcessor(ChannelHandlerContext channelHandlerContext ,T t);





}
